import Cookies from 'js-cookie'

//把token存到Cookies里面  实现持久化缓存
// 定义一个常量，方便后面修改
const TokenKey = 'hrsass_token'
const TimeKey = 'hrsass_login_time'

//存
export function getToken() {
    return Cookies.get(TokenKey)
}

//取
export function setToken(token) {
    return Cookies.set(TokenKey, token)
}

//移除
export function removeToken() {
    return Cookies.remove(TokenKey)
}

//设置时间戳 token失效时间
export function setTime() {
    return Cookies.set(TimeKey, Date.now())
}
export function getTime() {
    return Cookies.get(TimeKey)
}